#!/usr/bin/env python
# coding=utf-8


import datetime

class RepeatedRecordException(Exception):pass

class ScoreDB:
	"""
	Database to storage scores
	"""
	def __init__(self, filepath):
		"""
		Init class
		@param filepath: file which to store the database
		  type: unicode
		@exception IOError if open file error
		"""
		self.db = sqlite3.connect(filepath)

	def _create_tables(self):
		"""
		# private
		"""
		pass
	
	def add_team(self, teamRecord):
		"""
		Add a team to the database
		@param teamRecord - tuple, (enName, sName, cName, nation)
		@param enName: English name of the team
		  type: unicode
		@param sName: Simple Chinese name of the team
		  type: unicode
		@param cName: Complex Chinese name of the team
		  type: unicode
		@param nation: nation of the team
		  type: unicode
		@return True if store team successfully
		@exception raise RepeatedRecordException if the record is already in db
		"""
		pass

	def add_leaguematch(self, leagueMatchRecord):
		"""
		Add a league match to the database
		@param leagueMatchRecord - tuple, (lmName, nation, startDate, endDate)
		@param lmName: name of the league match, it is necessary
		  type: unicode
		@param nation: nation of the league match, None if no nation or several nations
		  type: unicode
		@param startDate: startDate of the league match, it is necessary
		  type: datetime.date
		@param endDate: endDate of the league match, it is necessary
		  type: datetime.date
		@return True if store league match successfully
		@exception raise RepeatedRecordException if the record is already in db
		"""
		pass

	def add_match_score(self, matchScoreRecord):
		"""
		Add a match score to the database
		@param matchScoreRecord - tuple, (masterTeam, guestTeam, leagueMatch, matchDate, matchTime, halfContestScore, wholeContestScore)
		@param masterTeam: English name of the master team
		  type: unicode
		@param guestTeam: English name of the guest team
		  type: unicode
		@param matchDate: date of the match
		  type: datetime.date
		@param matchTime: time of the match
		  type: datetime.time
		@param halfConstScore: score of the half contest
		  type: tuple: (m,n)
		@param wholeConstScore: score of the whole contest
		  type: tuple: (m,n)
		@return True if store match score successfully
		@exception raise RepeatedRecordException if the record is already in db
		"""
		pass

